Skip to content

Add test results summary and group logs - #63

Closed
mw-kapilg wants to merge 78 commits into
mainfrom
kapilg/test-results
Closed

Add test results summary and group logs#63
mw-kapilg wants to merge 78 commits into
mainfrom
kapilg/test-results

Conversation

@mw-kapilg

@mw-kapilg mw-kapilg commented Sep 4, 2025

Copy link
Copy Markdown
Contributor

NOTE: Not ready to be merged into main branch, awaiting release of genscript's new version

This feature creates an in-platform summary for MATLAB test results if the user has a MATLAB Test license. Once the new scriptgen version is live, a small portion of the code will be updated (added comments for same) before release.

Key highlights:

  • Each row of the table represents the test file.
  • All tests for a single file are shown under that file.
  • The files with same name and different parent directories are shown separately and you can hover over the file name to see its path.
  • The table in table format allows easy management of test cases for a test file
  • You see the logs in-place for a failed/incomplete. If there are more than failures within a test case, say multiple verification failures, each verification failure will have its own dropdown and log box.
  • The help button redirects users to our plugin's configuration guide.

P.S. These functions would also be utilized in run-command and run-build actions to the generate test results summary

Screenshot 2025-09-05 145333

Some additional changes:

  • The test logs get grouped by test class now
  • Updated grouping of logs (similar to run-build task grouping)

Old:
Screenshot 2025-09-04 181035

New:
Screenshot 2025-09-04 181152
Screenshot 2025-09-04 180712

Comment thread src/index.ts Fixed
@mw-kapilg

Copy link
Copy Markdown
Contributor Author

Is there a way to run .m test files in a particular order?
I need to use it to intentionally cause a fatal assertion failure so that all tests after it (tNotRun) do not run while all before it (TheTruth, sltestfile, etc.) should run

Comment thread .github/workflows/bat.yml Outdated
Comment thread plugins/+ciplugins/+github/TestResultsSummaryPlugin.m
Comment thread src/index.ts Outdated
Comment thread src/test-data/testResultsArtifacts/t1/linux/matlabTestResults.json
Comment thread src/index.ts Fixed
Comment thread src/testResultsSummary.ts
@davidbuzinski

davidbuzinski commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

Is there a way to run .m test files in a particular order? I need to use it to intentionally cause a fatal assertion failure so that all tests after it (tNotRun) do not run while all before it (TheTruth, sltestfile, etc.) should run

I don't totally understand which test this is causing problems for (maybe you can comment directly on that code block so we don't have to keep quote replying this thread), but I wonder if updating the function calls to be less dependent on global state and more flexible for testing will help us come up with a better solution. Requiring things to happen in a particular order, using workarounds that customers might not be using or be aware of, feels like a bit of a code smell.

@sameagen-MW

Copy link
Copy Markdown
Contributor

Adding Houman as a reviewer since we're adding user-visible messages.

@mw-hrastega

Copy link
Copy Markdown
Member

Adding Houman as a reviewer since we're adding user-visible messages.

Thank you, Sam.

@mw-kapilg: Can you point me to the file(s) including the new user-facing text/messages?

@mw-hrastega mw-hrastega removed their assignment Sep 5, 2025

@sameagen-MW sameagen-MW left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, thanks so much for your effort here! I think refactoring the environment variable readinging into index.ts is the biggest thing for me.

methods (Access=protected)
function reportFinalizedSuite(plugin, pluginData)
% Checkout MATLAB Test license
license('checkout', 'matlab_test');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the license be manually returned? Or will it be returned automatically after this method finishes.

Comment thread plugins/+ciplugins/+github/TestResultsSummaryPlugin.m
Comment thread plugins/+ciplugins/+github/TestResultsSummaryPlugin.m
Comment on lines +4 to +8
methods
function plugins = providePlugins(~, ~)
plugins = ciplugins.github.GitHubLogPlugin();
end
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we end up backporting service location @davidbuzinski? Otherwise, will we need to document that this feature is only suppored for R2024a (iirc?) and forward?

Comment thread src/index.ts
Comment thread src/index.ts
Comment thread src/testResultsSummary.ts
Comment thread src/testResultsSummary.ts
Comment on lines +49 to +63
try {
const helpLink = `<a href="https://github.com/matlab-actions/run-tests/blob/main/README.md"` +
` target="_blank" title="View documentation">ℹ️</a>`;
const header = getTestHeader(testResults, stats);
const detailedResults = getDetailedResults(testResults);

core.summary
.addHeading('MATLAB Test Results (' + process.env.GITHUB_ACTION + ') ' + helpLink)
.addRaw(header, true)
.addHeading('All tests', 3)
.addRaw(detailedResults, true)
.write();
} catch (e) {
console.error('An error occurred while adding the test results to the summary:', e);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What here can actually throw? We should try to keep the try block as tightly scoped as possible, only containing things that can actually fair for readability.

Comment thread src/testResultsSummary.ts
Comment thread src/testResultsSummary.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants